#ifndef HEAD_H
#define HEAD_H


#include <func.h>
#include <syslog.h>
typedef struct train_s{

    int length;
    char data[1000];
}train_t;

typedef struct node
{
    char *data;
    struct node *next;
} node_t;

typedef struct
{
    node_t *front;
    node_t *rear;
    int size;
} List, Stack;


int logSet(char *msg);

#define NETDISK_LOG_INFO(retval, val, msg){     \
    if(retval == val){                          \
        logSet(msg);                            \
    }                                           \
}

#define NETDISK_LOG_ERR(retval, val, msg) {     \
    if(retval != val){                          \
        logSet(msg);                            \
        perror(msg);                            \
        exit(1);                                \
    }                                           \
}
int recvFile(int netfd);
int sendFile(int netfd,char*psth,char*filename);
int Mkdir(int netfd,char* addr,char* dirname);
int Rmdir(int netfd,char* addr,char *dirname);
int Remove(int netfd,char *addr,char *dirname);
int pwd(int netfd,char *addr,char *dirname);
List *createList();
Stack *createStack();
char* stackPeek(Stack* stack);
int stackPush(Stack* stack, char* data);
char* stackPop(Stack* stack);
int rearInsert(List *list, char *data);
int frontInsert(List *list, char *data);
int deleteList(List *list, char *data);
List* searchList(List* list, char *data);
int destoryList(List *list);
char* segWord(char* cmd, int strtype);
Stack* segPath(char* path);
int cdCmd(char *toPath, char *nowPath);
int lsCmd(int netfd, char* nowPath);
int judgeCmd(char* word);

#endif
